<template>
	<view class="home-page">
		<button @tap="handleStart">拍照</button>


		<swiper class="swiper">
			<swiper-item class="swiper-item">
				<image class="swiper-item-img" src="@/static/banner.png" />
			</swiper-item>
		</swiper>

		<view class="info">
			<view class="info-left">
				<image class="info-img" src="@/static/info.png" />
			</view>
			<view class="info-center">
				<view class="info-title">个人信息完善</view>
				<view class="info-subtitle">完善个人信息，收取祝福红包</view>
			</view>
			<view class="info-right">
				<button class="info-btn">去完善</button>
			</view>
		</view>

		<view class="box1">
			<view class="box1-item">
				<image class="box1-item-img" src="@/static/box1_1.png" />
				<view class="box1-item-text">学院风采</view>
			</view>
			<view class="box1-item">
				<image class="box1-item-img" src="@/static/box1_2.png" />
				<view class="box1-item-text">学院风采</view>
			</view>
			<view class="box1-item">
				<image class="box1-item-img" src="@/static/box1_3.png" />
				<view class="box1-item-text">学院风采</view>
			</view>
			<view class="box1-item">
				<image class="box1-item-img" src="@/static/box1_4.png" />
				<view class="box1-item-text">学院风采</view>
			</view>
		</view>

		<view class="box2">
			<view class="box2-left">
				<view class="box2-item one">
					<view class="box2-item-title">我的名片</view>
					<view class="box2-item-sub">查看我的名片</view>
					<view class="box2-item-img"></view>
				</view>
			</view>
			<view class="box2-right">
				<view class="box2-item two">
					<view class="box2-item-title">我的课程</view>
					<view class="box2-item-sub">快速查看自己的课程</view>
					<view class="box2-item-img"></view>
				</view>
				<view class="box2-item three">
					<view class="box2-item-title">我的待办</view>
					<view class="box2-item-sub">快速绑定，简单便捷</view>
					<view class="box2-item-img"></view>
				</view>
			</view>
		</view>

		<view class="box3">
			<image class="box3-banner" />
			<view class="box3-list">
				<view class="box3-item" v-for="item in 3">
					<image class="box3-item__left" src="" />
					<view class="box3-item__center">
						<image class="box3-item-avatar" src="" />
						<view class="box3-item-info">
							<view class="box3-item-info__name">薄蓓真</view>
							<view class="box3-item-info__date">04月07日</view>
						</view>
					</view>
					<button class="box3-item__right">去祝福</button>
				</view>
			</view>
			<view class="box3-more">查看更多</view>
		</view>

		<my-section title="排行榜单" page="">
			<RankList />
		</my-section>

		<my-section title="学院头条" page="">
			<h1>World</h1>
		</my-section>

		<!-- 骨架屏 -->
		<!-- <view class="sk-container">
      <swiper class="swiper" current="0" autoplay="false">
        <swiper-item
          class="swiper-item"
          style="
            position: absolute;
            width: 100%;
            height: 100%;
            transform: translate(0%, 0px) translateZ(0px);
          "
        >
          <image class="swiper-item-img sk-image"></image>
        </swiper-item>
      </swiper>
      <view class="info">
        <view class="info-left">
          <image class="info-img sk-image"></image>
        </view>
        <view class="info-center">
          <view class="info-title sk-transparent sk-text-13-8889-429 sk-text"
            >个人信息完善</view
          >
          <view class="info-subtitle sk-transparent sk-text-15-6250-689 sk-text"
            >完善个人信息，收取祝福红包</view
          >
        </view>
        <view class="info-right">
          <button
            class="info-btn sk-transparent sk-button sk-pseudo sk-pseudo-circle"
          >
            去完善
          </button>
        </view>
      </view>
      <view class="box1">
        <view class="box1-item">
          <image class="box1-item-img sk-image"></image>
          <view
            class="box1-item-text sk-transparent sk-text-13-8889-534 sk-text"
            >学院风采</view
          >
        </view>
        <view class="box1-item">
          <image class="box1-item-img sk-image"></image>
          <view
            class="box1-item-text sk-transparent sk-text-13-8889-722 sk-text"
            >学院风采</view
          >
        </view>
        <view class="box1-item">
          <image class="box1-item-img sk-image"></image>
          <view
            class="box1-item-text sk-transparent sk-text-13-8889-402 sk-text"
            >学院风采</view
          >
        </view>
        <view class="box1-item">
          <image class="box1-item-img sk-image"></image>
          <view
            class="box1-item-text sk-transparent sk-text-13-8889-300 sk-text"
            >学院风采</view
          >
        </view>
      </view>
      <view class="box2">
        <view class="box2-left">
          <view class="box2-item sk-image one">
            <view
              class="box2-item-title sk-transparent sk-text-13-6364-132 sk-text"
              >我的名片</view
            >
            <view
              class="box2-item-sub sk-transparent sk-text-13-8889-15 sk-text"
              >查看我的名片</view
            >
            <view class="box2-item-img sk-image"></view>
          </view>
        </view>
        <view class="box2-right">
          <view class="box2-item two sk-image">
            <view
              class="box2-item-title sk-transparent sk-text-13-6364-798 sk-text"
              >我的课程</view
            >
            <view
              class="box2-item-sub sk-transparent sk-text-13-8889-491 sk-text"
              >快速查看自己的课程</view
            >
            <view class="box2-item-img sk-image"></view>
          </view>
          <view class="box2-item three sk-image">
            <view
              class="box2-item-title sk-transparent sk-text-13-6364-663 sk-text"
              >我的待办</view
            >
            <view
              class="box2-item-sub sk-transparent sk-text-13-8889-890 sk-text"
              >快速绑定，简单便捷</view
            >
            <view class="box2-item-img sk-image"></view>
          </view>
        </view>
      </view>
      <view class="box3">
        <image class="box3-banner sk-image"></image>
        <view class="box3-list">
          <view class="box3-item">
            <image class="box3-item__left sk-image"></image>
            <view class="box3-item__center">
              <image class="box3-item-avatar sk-image"></image>
              <view class="box3-item-info">
                <view
                  class="box3-item-info__name sk-transparent sk-text-13-6364-153 sk-text"
                  >薄蓓真</view
                >
                <view
                  class="box3-item-info__date sk-transparent sk-text-13-8889-889 sk-text"
                  >04月07日</view
                >
              </view>
            </view>
            <button
              class="box3-item__right sk-transparent sk-button sk-pseudo sk-pseudo-circle"
            >
              去祝福
            </button>
          </view>
          <view class="box3-item">
            <image class="box3-item__left sk-image"></image>
            <view class="box3-item__center">
              <image class="box3-item-avatar sk-image"></image>
              <view class="box3-item-info">
                <view
                  class="box3-item-info__name sk-transparent sk-text-13-6364-698 sk-text"
                  >薄蓓真</view
                >
                <view
                  class="box3-item-info__date sk-transparent sk-text-13-8889-351 sk-text"
                  >04月07日</view
                >
              </view>
            </view>
            <button
              class="box3-item__right sk-transparent sk-button sk-pseudo sk-pseudo-circle"
            >
              去祝福
            </button>
          </view>
          <view class="box3-item">
            <image class="box3-item__left sk-image"></image>
            <view class="box3-item__center">
              <image class="box3-item-avatar sk-image"></image>
              <view class="box3-item-info">
                <view
                  class="box3-item-info__name sk-transparent sk-text-13-6364-787 sk-text"
                  >薄蓓真</view
                >
                <view
                  class="box3-item-info__date sk-transparent sk-text-13-8889-565 sk-text"
                  >04月07日</view
                >
              </view>
            </view>
            <button
              class="box3-item__right sk-transparent sk-button sk-pseudo sk-pseudo-circle"
            >
              去祝福
            </button>
          </view>
        </view>
      </view>
    </view> -->
	</view>
</template>

<script lang="ts" setup>
	import { onMounted, ref } from "vue";
	import RankList from "./components/rank-list/index.vue";
	// import Skeleton from "./skeleton.vue";

	const loading = ref(true);

	// onMounted(() => {
	//   setTimeout(() => {
	//     // loading.value = false;
	//   }, 3000);
	// });

	const handleStart = () => {
		// #ifdef MP-WEIXIN
		uni.chooseMedia({
			success: (res) => {
				console.log('res', res)
			}
		})
		// #endif
		
		// #ifdef APP-PLUS
		// 使用 HTML5+ 中的能力要拍照。独立属于 APP 情况下。
		const myCamera = plus.camera.getCamera()
		myCamera.captureImage((res) => {
			// 成功的回调
			console.log('拍照成功', res)
		}, () => {
			// 失败的回调
		}, {
			// 额外的配置项
		})
		// #endif
		
	}
</script>

<style lang="scss">
	// @import "./skeleton.scss";

	.home-page {
		.swiper {
			padding: 0 40rpx;
			height: 188rpx;

			&-item-img {
				width: 100%;
				height: 100%;
			}
		}

		.info {
			display: flex;
			align-items: center;
			margin: 18rpx 40rpx 0;
			height: 106rpx;
			background: #ffffff;
			border-radius: 53rpx;
			border: 2rpx solid #f1f1f1;

			&-left {
				margin-left: 30rpx;
				width: 78rpx;
				height: 70rpx;
			}

			&-img {
				display: block;
				width: 100%;
				height: 100%;
			}

			&-right {
				margin-right: 30rpx;
			}

			&-btn {
				width: 118rpx;
				height: 44rpx;
				line-height: 44rpx;
				font-size: 24rpx;
				font-weight: 500;
				color: #ffffff;
				background: #465eab;
				border-radius: 22rpx;
			}

			&-center {
				padding: 0 16rpx;
				flex: 1;
			}

			&-title {
				height: 36rpx;
				line-height: 36rpx;
				font-size: 26rpx;
				font-weight: 500;
				color: #333333;
			}

			&-subtitle {
				height: 32rpx;
				line-height: 32rpx;
				font-size: 22rpx;
				font-weight: 400;
				color: #999999;
			}
		}

		.box1 {
			display: flex;
			margin-top: 28rpx;

			&-item {
				display: flex;
				align-items: center;
				flex-direction: column;
				flex: 1;
			}

			&-item-img {
				width: 80rpx;
				height: 80rpx;
			}

			&-item-text {
				margin-top: 20rpx;
				height: 36rpx;
				line-height: 36rpx;
				font-size: 26rpx;
				font-weight: 400;
				color: #505050;
			}
		}

		.box2 {
			margin: 36rpx 40rpx 0;
			display: flex;
			justify-content: space-between;

			&-left {
				width: 276rpx;
			}

			&-right {
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				width: 376rpx;
			}

			&-item {
				position: relative;
				padding-left: 20rpx;
				border-radius: 10rpx;
				overflow: hidden;

				&-title {
					margin-top: 22rpx;
					height: 44rpx;
					line-height: 44rpx;
					font-size: 32rpx;
					font-weight: 500;
				}

				&-sub {
					margin-top: 8rpx;
					height: 36rpx;
					line-height: 36rpx;
					font-size: 26rpx;
					font-weight: 400;
					color: #333333;
				}

				&-img {
					position: absolute;
					right: 0;
					bottom: 0;
					background-size: 100%;
					background-repeat: no-repeat;
				}
			}

			.one {
				height: 298rpx;
				background-color: rgba($color: #ff5f5f, $alpha: 0.07);

				.box2-item-title {
					color: #ff5f5f;
				}

				.box2-item-img {
					width: 170rpx;
					height: 140rpx;
					background-image: url("@/static/box2_1.png");
				}
			}

			.two {
				height: 142rpx;
				background-color: rgba(234, 239, 255, 1);

				.box2-item-title {
					color: #465eab;
				}

				.box2-item-img {
					width: 86rpx;
					height: 86rpx;
					background-image: url("@/static/box2_2.png");
				}
			}

			.three {
				height: 142rpx;
				background-color: rgba(255, 197, 68, 0.13);

				.box2-item-title {
					color: #ff8d00;
				}

				.box2-item-img {
					width: 86rpx;
					height: 86rpx;
					background-image: url("@/static/box2_3.png");
				}
			}
		}

		.box3 {
			margin: 26rpx 40rpx 0;
			background: #ffffff;
			box-shadow: 0rpx 6rpx 18rpx 0rpx rgba(202, 202, 202, 0.5);
			border-radius: 0rpx 0rpx 22rpx 22rpx;

			&-banner {
				width: 100%;
				height: 190rpx;
				background-color: green;
				overflow: hidden;
			}

			&-list {
				padding: 0 30rpx;
			}

			&-item {
				display: flex;
				padding: 26rpx 10rpx;
				border-bottom: 2rpx solid #979797;

				&__left {
					width: 86rpx;
					height: 86rpx;
					background-color: red;
				}

				&__right {
					width: 118rpx;
					height: 44rpx;
					line-height: 44rpx;
					font-size: 22rpx;
					font-weight: 500;
					color: #ffffff;
					background: #465eab;
					border-radius: 22rpx;
				}

				&__center {
					padding: 0 24rpx;
					flex: 1;
					display: flex;
				}

				&-avatar {
					margin-right: 14rpx;
					width: 86rpx;
					height: 86rpx;
					background-color: #ff5f5f;
				}

				&-info__name {
					height: 44rpx;
					line-height: 44rpx;
					font-size: 32rpx;
					font-weight: 500;
					color: #333333;
				}

				&-info__date {
					height: 36rpx;
					line-height: 36rpx;
					font-size: 26rpx;
					font-weight: 400;
					color: #999999;
				}
			}

			&-more {
				height: 68rpx;
				line-height: 68rpx;
				text-align: center;
				font-size: 22rpx;
				font-weight: 500;
				color: #999999;
			}
		}
	}
</style>